<SCRIPT LANGUAGE="JavaScript">
<!--
/**
*	
*/

function f_gridDblFunc(keyID) {
	
	var curKeyID = trselObj.f_get_select_key();
//	if (curKeyID==""||curKeyID == null) return ;
	curKeyID = curKeyID[0];
    if (curKeyID == "") return ;
//	alert("curKeyID = " + curKeyID);

	var account_date = document.all("extend_param").value.split(";");
	var trObj = trselObj.f_getSelectTR();
	/*
	begin_date =document.all("startDate").value  ;  //trselObj.f_getTDValueByKeyName(curKeyID ,"v_finance_services_ste.submit_date");
	end_date =document.all("endDate").value  ;       //trselObj.f_getTDValueByKeyName(curKeyID ,"v_finance_services_ste.service_id");
	*/
	var begin_date = account_date[0];  //trselObj.f_getTDValueByKeyName(curKeyID ,"v_finance_services_ste.submit_date");
	var end_date = account_date[1];       //trselObj.f_getTDValueByKeyName(curKeyID ,"v_finance_services_ste.service_id");
	var service_id = trselObj.f_getTDValueByKeyName(curKeyID ,"v_groupaudit_service_gr.service_id");
	var loca_code = trselObj.f_getTDValueByKeyName(curKeyID ,"v_groupaudit_service_gr.local_code");
	var element_code = trselObj.f_getTDValueByKeyName(curKeyID ,"v_groupaudit_service_gr.element_code");
	var tax_rate = trselObj.f_getTDValueByKeyName(curKeyID ,"v_groupaudit_service_gr.tax_rate");
	var price_cost = trselObj.f_getTDValueByKeyName(curKeyID ,"v_groupaudit_service_gr.price_cost");
	var dept_id = trselObj.f_getTDValueByKeyName(curKeyID ,"v_groupaudit_service_gr.dept_id");
	var mach_percent = trselObj.f_getTDValueByKeyName(curKeyID ,"v_groupaudit_service_gr.mach_percent");



	var bottomfrm = parent.frames("frmformdata");

	var where_sql = "finance_services.price_cost = "+price_cost+" and  finance_services.dept_id = ? and base_warehouse_loca.loca_code = ? and finance_services.element_code = ? and finance_services.mach_percent ="+mach_percent ;


	where_sql=where_sql+" and to_char(submit_date,'yyyy-mm-dd')=? and service_id = ?";
	var where_type = "string;string;string"+";"+document.all("where_type").value;
	var where_value = dept_id+";"+loca_code+";"+element_code+";"+document.all("where_value").value;

	//alert(bottomfrm.location.href.indexOf("form_groupaudit_service_gr.jsp") );

	if (bottomfrm.location.href.indexOf("form_groupaudit_service_g.jsp") >= 0) {
		var contextPath = "<%=CONTEXTPATH%>";
		var funcid = "GROUPAUDIT_SERVICE";

		var href = contextPath + g_layoutForm + funcid + "&pageType=subgrid";
		href += "&where_sql=notDoQuery";
		/*
		href += "&where_sql=" + where_sql;
		href += "&where_value=" + where_value;
		href += "&where_type=" + where_type;
		href += "&orgwhere_sql=" + where_sql;
		href += "&orgwhere_type=" + where_type;
		href += "&orgwhere_value=" + where_value;
		*/
		//alert("href = " + href);

		parent.frames("frmformdata").document.location = href
	} else {
		bottomfrm.document.all("where_sql").value = where_sql;
		bottomfrm.document.all("where_value").value = where_value;
		bottomfrm.document.all("where_type").value = where_type;
		//bottomfrm.document.all("orgwhere_sql").value = where_sql;
		///bottomfrm.document.all("orgwhere_type").value = where_value;
		//bottomfrm.document.all("orgwhere_value").value = where_type;
		bottomfrm.f_reloadPage();
	}
}


function f_refresh() {
	var bottomfrm = parent.frames("frmformdata");
	bottomfrm.document.all("where_sql").value ="notDoQuery";
	bottomfrm.document.all("where_value").value = "";
	bottomfrm.document.all("where_type").value = "";
	bottomfrm.f_reloadPage();
	f_reloadPage();

	alert("<eam:message key="message.finance.groupsuccess"/>");
}

function f_otherClick(){
	f_getData();
}

function f_getData(){

	var curKeyID = trselObj.f_get_select_key();
	var varQTY = 0.00;
    var varCost = 0.00;
	var varCostTax = 0.00;
	for (var i = 0 ,n = curKeyID.length;i<n;i++){
		varQTY = (varQTY- -trselObj.f_getTDValueByKeyName(curKeyID[i] ,"sum(qty_process)")).toFixed(3);
		varCost = (varCost - -trselObj.f_getTDValueByKeyName(curKeyID[i] ,"sum(totle_cost)")).toFixed(2);
		varCostTax =  (varCostTax - -trselObj.f_getTDValueByKeyName(curKeyID[i] ,"sum(totle_cost_tax)")).toFixed(2);
	}

	document.all("totalQTYname").innerText = varQTY;
	document.all("totalCostName").innerText = varCost;
	document.all("totalCostTaxName").innerText = varCostTax;

}

//-->
</SCRIPT>
<table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
  <tr>
	<td>
		<label id="totalQTY" class="gridData"><eam:message key="column.GROUPAUDIT_SERVICE.finance_services.qty_process" />: </label>
		<!--<input type="text" name="totleQTYname" id="totleQTYname"   size="10" align="center" disabled style="border:0 ;bgcolor:#CCCCCC">-->
		<label id="totalQTYname">&nbsp;&nbsp;&nbsp;&nbsp;</label>
		<label id="totalCost" class="gridData"><eam:message key="column.GROUPAUDIT_SERVICE.finance_services.totle_cost" />: </label>
		<label id="totalCostName">&nbsp;&nbsp;&nbsp;&nbsp;</label>
		<label id="totalCostTax" class="gridData"><eam:message key="column.GROUPAUDIT_SERVICE.finance_services.totle_cost_tax" />: </label>
		<label id="totalCostTaxName">&nbsp;&nbsp;&nbsp;&nbsp;</label>
	</td>
  </tr>
</table>


